Skip to content

Conversation

@sophiatev
Copy link
Contributor

A breaking change was introduced in TaskOptions where there are now two constructors which both have all optional parameters. Now creating a new TaskOption() with no arguments is ambiguous between the two constructors. One constructor was changed to have its parameter be non-optional, whereas the other constructor remains as having all optional parameters. This should make creating a new TaskOption() unambiguous (it will correspond to the second constructor with two optional parameters).

@sophiatev sophiatev marked this pull request as ready for review July 10, 2025 22:14
@cgillum
Copy link
Member

cgillum commented Jul 10, 2025

@sophiatev thanks for this PR! Looking at the code history, I think there might be a more correct change. The first constructor was originally the only constructor, so I think a safer fix would be to just change the second constructor (which is the new one) to make both parameters required. Your current fix solves the ambiguity problem, but I'm not 100% certain that it will solve the binary compatibility problem.

Also adding @YunchuWang for visibility since it was #426 that introduced this change.

@sophiatev
Copy link
Contributor Author

@sophiatev thanks for this PR! Looking at the code history, I think there might be a more correct change. The first constructor was originally the only constructor, so I think a safer fix would be to just change the second constructor (which is the new one) to make both parameters required. Your current fix solves the ambiguity problem, but I'm not 100% certain that it will solve the binary compatibility problem.

Also adding @YunchuWang for visibility since it was #426 that introduced this change.

@YunchuWang is there ever a situation where you would want to allow just specifying a tags parameter but not a retry parameter? Just want to double-check that it's okay if we make both parameters required for the new TaskOptions constructor you introduced.

Also adding @jviau since he suggested the initial fix and has a much better understanding of this binary compatibility stuff than I do.

@jviau
Copy link
Member

jviau commented Jul 11, 2025

but I'm not 100% certain that it will solve the binary compatibility problem.

There was no binary compatibility problem with the original change. Only a new ambiguity issue at compilation time. The proposed changes resolve the ambiguity problem and do not affect the binary compatibility (so all good there).

With that said, you would prefer the 2nd ctor to have optional params removed that is fine as well. Its a question of, do you want new(tags: <...>) to work or not? But honestly, tags have init on them, so it isn't a big deal to have it via ctor. You can always do new() { Tags = <...> }

startOptions.Version.Should().BeNull();
startOptions.InstanceId.Should().BeNull();
startOptions.StartAt.Should().BeNull();
startOptions.Tags.Should().BeEmpty();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that tags defaults to empty here but defaults to null in the *Options classes. Oh well - not something to deal with in this PR.

@sophiatev sophiatev merged commit 387ce19 into main Jul 11, 2025
4 checks passed
@sophiatev sophiatev deleted the stevosyan/fix-breaking-change-for-task-options branch July 11, 2025 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants